package com.example.studyllm.controller.rag;


import com.example.studyllm.dto.validate.Add;
import com.example.studyllm.dto.validate.Update;
import com.example.studyllm.entity.rag.RagSession;
import com.example.studyllm.service.rag.RagSessionService;
import com.example.studyllm.vo.base.PageResultVO;
import com.example.studyllm.vo.base.Result;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;


/**
 * @author kw
 * @since 2025-05-20 09:33:14.822775
 */
@RestController
@RequestMapping("/ragSession")
public class RagSessionController {

    @Resource
    private RagSessionService ragSessionService;

    /**
     * 通过id查询
     */
    @GetMapping("/{id}")
    public Result<RagSession> getById(@PathVariable(value = "id") Integer id) {
        return Result.success(ragSessionService.getById(id));
    }

    /**
     * 新增
     */
    @PostMapping("/")
    public Result save(@RequestBody RagSession ragSession) {
        return Result.success(ragSessionService.addRagSession(ragSession));
    }

    /**
     * 通过id删除
     */
    @DeleteMapping("/{id}")
    public Result delete(@PathVariable(value = "id") String ids) {
        ragSessionService.deleteByIds(ids);
        return Result.success();
    }

    /**
     * 修改
     */
    @PutMapping("/")
    public Result updateById(@RequestBody RagSession ragSession) {
        return Result.success(ragSessionService.updateRagSessionById(ragSession));
    }

    /**
     * 分页查询
     */
    @GetMapping("/")
    public Result<PageResultVO<RagSession>> page(RagSession ragSession) {
        return Result.success(ragSessionService.getPage(ragSession));
    }

}